<!DOCTYPE html>
<html>

<head>
    <title>打卡签到</title>
    <meta charset="utf-8"/>
    <meta http-equiv="refresh" content="${refresh!}">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="${ctxPath}/assets/common/libs/layui/css/layui.css?v=${constants.getReleaseVersion()}"/>
    <link rel="stylesheet" href="${ctxPath}/assets/common/module/admin.css?v=${constants.getReleaseVersion()}"/>
	<script type="text/javascript" src="http://wwcdn.weixin.qq.com/node/wework/wwopen/js/wwLogin-1.2.4.js"></script>

    
    <style>

	 .qrcode-item {
		padding-left: 25px;
		padding-top: 25px;
	}

     .attendance-body {
         width: 285px;
         height: 285px;
         padding-top: 20px;
         margin: auto;
     }


     .attendance-body-img {
         width: 90%;
         height: 90%;
         border-radius:2em;
         border: 5px solid #1e9fff
     }

     .attendance-body-name {
         font-size: xx-large;
         text-align: center;
         padding-bottom: 20px;
         color: #1e9fff;
     }

     .attendance-body-lab {
         text-align: center;
         font-size: large;
     }
    </style>
</head>

<body>
<div class="qrcode-item" id="wx_reg">
</div>


@/* 加入contextPath属性和session超时的配置 */
<script type="text/javascript">
    var Feng = {
        ctxPath: "${ctxPath}",
        version: '${constants.getReleaseVersion()}'
    };
</script>
<script type="text/javascript" src="${ctxPath}/assets/common/libs/layui/layui.js?v=${constants.getReleaseVersion()}"></script>
<script type="text/javascript" src="${ctxPath}/assets/common/js/common.js?v=${constants.getReleaseVersion()}"></script>

<script>
    layui.use(['layer', 'element','ax','func'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var $ax = layui.ax;
        var element = layui.element;

        var weChat = {};
        weChat.init = function (init) {
            if(init){
                var wwLogin = new WwLogin({
                    "id" : "wx_reg",
                    "appid" : "${appid!}",
                    "agentid" : "${agentid}",
                    "redirect_uri" :"${redirect_uri!}",
                    "state" : "${state}",
                    "href" : "${href}",
                    "lang": "zh"
                });
                /*for(i=0,len = 8;i<len;i++){
                    var id = "wx_reg_"+i;
                    if(tagId && tagId === id){
                        var innerHtml = '<div class="login-wrapper">\n' +
                            '\n' +
                            '\t\t<div class="attendance-body">\n' +
                            '\t\t\t<div class="attendance-body-name">${name!}</div>\n' +
                            '\t\t\t<img src="/system/previewAvatar" class="attendance-body-img">\n' +
                            '\t\t\t<label id="lab" class="attendance-body-lab"></label>\n' +
                            '\t\t\t<div>签字状态: ${sucess}</div>\n' +
                            '\t\t</div>\n' +
                            '\n' +
                            '\t</div>';
                        $('#'+id).append(innerHtml);
                    }else{
                        var wwLogin = new WwLogin({
                            "id" : id,
                            "appid" : "${appid!}",
                            "agentid" : "${agentid}",
                            "redirect_uri" :"${redirect_uri!}",
                            "state" : id,
                            "href" : "${href}",
                            "lang": "zh"
                        });
                    }
                }*/
            }
        }
        var id = "${tagId}";
        console.log("扫描成功后的值"+id);
        if(id){
            weChat.init(true,id);
            var i = 7;
            $(".login-wrapper").show();
            document.getElementById("lab").innerText = "["+ i + "]秒后自动刷新...";
            var timer = null;

            function start_timer()
            {
                timer = window.setInterval(function (){
                    var lab = document.getElementById("lab");
                    i--;
                    lab.innerText = "["+ i + "]秒后自动刷新...";
                    if(i==0)
                    {
                        var wwLogin = new WwLogin({
                            "id" : "wx_reg",
                            "appid" : "${appid!}",
                            "agentid" : "${agentid}",
                            "redirect_uri" :"${redirect_uri!}",
                            "state" : "${state}",
                            "href" : "${href}",
                            "lang": "zh"
                        });

                    }
                }, 1000);
            }
            start_timer();
        }else{
            weChat.init(true);
        }

        /*var ajax = new $ax(Feng.ctxPath + "/eduCourseSelectionInfo/list", function (rsp) {
            console.log(rsp);
            var datas = rsp.data;
            for(i=0,len = datas.length;i<len;i++){
                var data = datas[i];
                var id = "wx_reg_"+i;
                $("#wx_reg_"+i+"_name").text(data.studentName);
                var wwLogin = new WwLogin({
                    "id" : id,
                    "appid" : "${appid!}",
                    "agentid" : "${agentid}",
                    "redirect_uri" :"${redirect_uri!}",
                    "state" : id,
                    "href" : "${href}",
                    "lang": "zh"
                });
            }
        }, function (data) {
            Feng.error("删除失败!" + data.responseJSON.message + "!");
        });
        ajax.set("status", "2");
        ajax.start();*/
    });

</script>
</body>
</html>